package com.second.mapper;

import com.second.model.pojo.FShop;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;

import org.springframework.web.bind.annotation.ResponseBody;


@ResponseBody
@Repository
public interface FShopMapper  {
    @Select("select * from f_shop")
    ArrayList<FShop> findAll();

    @Select("select * from f_shop where id=#{value}")
    FShop getById(Integer id);

    @Select("select * from f_shop where shop_name like concat ('%',#{value},'%')")
    List<FShop> selectByShopName(String shopName);

    @Select("select * from f_shop where consumption between #{start} and #{end}")
    List<FShop> selectByPrice(@Param("start") Double start, @Param("end") Double end);

    @Select("select * from f_shop where type=#{value}")
    List<FShop> findByType(Integer type);

    @Select("select * from f_shop where area=#{value}")
    List<FShop> findByArea(String area);
    List<FShop> findAllByScore();
    @Select("select * from f_shop where area=#{value}")
    List<FShop> findAllByArea(String area);

    @Select("select * from f_shop where place=#{value}")
    List<FShop> findByPlace(String place);

    List<FShop> findAllByCityOrProvinceOrAreaContainsOrPlace(String province, String city, String area ,String place);

    @Select(value = "select * from f_shop order by shop_score desc")
    List<FShop> findAllByScoreDesc();

    @Select(value = "select * from f_shop where shop_status = #{value} order by shop_score desc")
    List<FShop> findAllByStatusAndScoreDesc(Integer status);

}
